%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
images=np.load("predict_image_epoch500_ns.npy")
recoloss=np.load("recon_loss_epoch500_ns.npy")
trajectory=np.load("trajectory_epoch500_ns.npy")
world=np.load("world1.npy")
len(trajectory.T)
plt.plot(recoloss)
start=0
goal=start+100
hoge= np.sqrt(len(images[0,0,start:goal]))
plt.figure(figsize=(15, 15), dpi=800)
for i in xrange(len(images[0,0,start:goal])):
plt.subplot(hoge+1,hoge+1 , i+1)
fig = plt.imshow(images[:,:,start+i])
plt.axis('off')
plt.figure()
plt.imshow(world,"gray")
plt.scatter(trajectory[0,0:100]-14,trajectory[1,0:100]-14,color='g')
plt.scatter(trajectory[0,0]-14,trajectory[1,0]-14,color='red')
plt.axis('off')
plt.show()
start=4000
goal=start+100
hoge= np.sqrt(len(images[0,0,start:goal]))
plt.figure(figsize=(15, 15), dpi=800)
for i in xrange(len(images[0,0,start:goal])):
plt.subplot(hoge+1,hoge+1 , i+1)
fig = plt.imshow(images[:,:,start+i])
plt.axis('off')
plt.figure()
plt.imshow(world,"gray")
plt.scatter(trajectory[0,4000:4100]-14,trajectory[1,4000:4100]-14,color='g')
plt.scatter(trajectory[0,4000]-14,trajectory[1,4000]-14,color='red')
plt.axis('off')
plt.show()
start=8000
goal=start+100
hoge= np.sqrt(len(images[0,0,start:goal]))
plt.figure(figsize=(15, 15), dpi=800)
for i in xrange(len(images[0,0,start:goal])):
plt.subplot(hoge+1,hoge+1 , i+1)
fig = plt.imshow(images[:,:,start+i])
plt.axis('off')
plt.figure()
plt.imshow(world,"gray")
plt.scatter(trajectory[0,8000:8100]-14,trajectory[1,8000:8100]-14,color='g')
plt.scatter(trajectory[0,8000]-14,trajectory[1,8000]-14,color='red')
plt.axis('off')
plt.show()
start=12000
goal=start+100
hoge= np.sqrt(len(images[0,0,start:goal]))
plt.figure(figsize=(15, 15), dpi=800)
for i in xrange(len(images[0,0,start:goal])):
plt.subplot(hoge+1,hoge+1 , i+1)
fig = plt.imshow(images[:,:,start+i])
plt.axis('off')
plt.figure()
plt.imshow(world,"gray")
plt.scatter(trajectory[0,12000:12100]-14,trajectory[1,12000:12100]-14,color='g')
plt.scatter(trajectory[0,12000]-14,trajectory[1,12000]-14,color='red')
plt.axis('off')
plt.show()
start=16000
goal=start+100
hoge= np.sqrt(len(images[0,0,start:goal]))
plt.figure(figsize=(15, 15), dpi=800)
for i in xrange(len(images[0,0,start:goal])):
plt.subplot(hoge+1,hoge+1 , i+1)
fig = plt.imshow(images[:,:,start+i])
plt.axis('off')
plt.figure()
plt.imshow(world,"gray")
plt.scatter(trajectory[0,16000:16100]-14,trajectory[1,16000:16100]-14,color='g')
plt.scatter(trajectory[0,16000]-14,trajectory[1,16000]-14,color='red')
plt.axis('off')
plt.show()
start=20000
goal=start+100
hoge= np.sqrt(len(images[0,0,start:goal]))
plt.figure(figsize=(15, 15), dpi=800)
for i in xrange(len(images[0,0,start:goal])):
plt.subplot(hoge+1,hoge+1 , i+1)
fig = plt.imshow(images[:,:,start+i])
plt.axis('off')
plt.figure()
plt.imshow(world,"gray")
plt.scatter(trajectory[0,20000:20100]-14,trajectory[1,20000:20100]-14,color='g')
plt.scatter(trajectory[0,20000]-14,trajectory[1,20000]-14,color='red')
plt.axis('off')
plt.show()
plt.imshow(world)
plt.figure()
plt.imshow(world,"gray")
plt.scatter(trajectory[0,:i]-14,trajectory[1,:i]-14,color='g')
plt.scatter(trajectory[0,0]-14,trajectory[1,0]-14,color='red')
plt.axis('off')
plt.show()
i=4000
plt.scatter(trajectory[0,-i:],trajectory[1,-i:], )
#plt.xlim([0, 28*3])
#plt.ylim([0,28*3])
hoge=5*np.array((np.cos(1002/10.),np.cos(1002/10.)))
print hoge
images[:,:,1]+hoge.T